<template>
  <div class="app-container">
    <el-form :model="quitFormData" ref="quitFormData" label-width="150">
            <el-row>
                <el-col :span="12">
                    <el-form-item label="离职日期" prop="quitDate">
                        <el-date-picker
                            :disabled="true"
                            style="width:60%"
                            v-model="quitFormData.quitDate"
                            type="date"
                            value-format="yyyy-MM-dd"
                            placeholder="选择开始日期时间">
                        </el-date-picker>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="是否完成交接" prop="isHandover">
                        <el-radio label="1" v-model="quitFormData.isHandover" :disabled="true">是</el-radio>
                        <el-radio label="0" v-model="quitFormData.isHandover" :disabled="true">否</el-radio>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                    <el-form-item label="是否归还设备" prop="isReturnEquipment">
                        <el-radio label="1" v-model="quitFormData.isReturnEquipment" :disabled="true">是</el-radio>
                        <el-radio label="0" v-model="quitFormData.isReturnEquipment" :disabled="true">否</el-radio>
                    </el-form-item>
              </el-col>
              <el-col :span="12">
                    <el-form-item label="初审部门" prop="approvedDept">
                      <el-cascader style="width: 81%;"  v-model="quitFormData.approvedDeptModel" :disabled="true"
                        :options="deptOptions"
                        :props="props"
                        clearable></el-cascader>
                    </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="离职原因" prop="quitRemarks">
                <el-input v-model="quitFormData.quitRemarks" type="textarea" style="width: 90%;" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="抄送人" prop="ccUsers">
                <el-tag v-for="item in quitFormData.ccUserList" :key="item.id" style="margin-left: 3px;">{{item.userName}}</el-tag>
              </el-form-item>
            <el-form-item label="上传附件" >
              <el-upload :disabled="true"
                :action="upload.url"
                class="upload-demo"
                :on-preview="handlePreview"
                :file-list="quitFormData.files">
              </el-upload>
            </el-form-item>
            <el-row>
              <el-col :span="12">
                  <el-form-item label="申请人" prop="leaveTotalTime">
                      {{quitFormData.createBy}}
                  </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="申请时间" prop="approvedDept">
                    {{parseTime(quitFormData.createTime)}}
                    </el-form-item>
              </el-col>
            </el-row>
        </el-form>
  </div>
</template>

<script>
import { treeselectAll } from "@/api/system/dept";

export default {
  name: "quitApplyDetail",
  props:{
    quitFormData: Object,
    isShowQuit: Boolean,
  },
  data() {
    return {
        fileList:[],
        upload:{
            url: process.env.VUE_APP_BASE_API + "/test/uploadImage",
        },
        props:{multiple: true},
        deptOptions:[],
    };
  },

  created() {
    this.getTreeselect()

  },
  methods: {
    handlePreview(file){
        this.preFile(file.url)
    },
    preFile(fileName){
      window.open(process.env.VUE_APP_BASE_API + "/school/file/" +fileName)
    },
    getTreeselect() {
        treeselectAll().then(response => {
            this.deptOptions = response.data;
        });
    },
  }
};
</script>
